Ändern der Konfiguration im Dialog

Die Änderung einer Konfiguration ist mit wenigen Funktionsbausteinen programmiert. das Beispielprogramm zeigt Ihnen, wie die Konfiguration einer Auftragsposition im Dialog geändert werden kann.

REPORT zsd_change_configuration.

*** Benötigte Type-Pools
TYPE-POOLS ibxx.

*** Variablen
DATA:
  lv_cuobj    TYPE cuobj,
  lv_object   TYPE rcuobn,
  lv_ucomm    TYPE syucomm,
  ls_root_obj TYPE ibxx_business_object.

*** Selektionsbild
PARAMETERS:
  p_vbeln     TYPE vbeln DEFAULT ‘11891’,
  p_posnr     TYPE posnr DEFAULT ‘90001’.

START-OF-SELECTION.
*** Konfigurationsinstanz zur Kundenauftragsposition
  SELECT SINGLE cuobj matnr
    FROM vbap INTO (lv_cuobj, lv_object)
   WHERE vbeln = p_vbeln
     AND posnr = p_posnr.

*** Aufruf der Konfiguration
  CALL FUNCTION ‘V45CU_CONFIGURATION’
    EXPORTING
      iv_instance                    = lv_cuobj
      iv_date                        = sy-datum
      iv_display                     = ‘ ‘
      iv_object_id                   = ‘MARA’
      iv_object                      = lv_object
    IMPORTING
      ev_return_with_functionkey     = lv_ucomm
    EXCEPTIONS
      internal_error                 = 1
      instance_not_found             = 2
      reference_instance_not_found   = 3
      instance_is_a_classification   = 4
      no_plant                       = 5
      no_quantity                    = 6
      no_connection_to_configuration = 7
      plant_not_allowed              = 8
      material_variant_not_allowed   = 9
      internal_error_ecm             = 10
      eoasl_not_allowed              = 11
      maxasl_not_allowed             = 12
      OTHERS                         = 13.
  IF sy-subrc <> 0.
*** Fehlermeldung
    MESSAGE i000(vz)
       WITH ‘Error’ sy-subrc ‘calling V45CU_CONFIGURATION’.
  ELSEIF lv_ucomm = ‘F11’.

*** SICHERN

*** Eigentlichen “Besitzer” der Konfiguration ermitteln
    CALL FUNCTION ‘CUCB_GET_OWNER_OF_CFG’
      EXPORTING
        i_instance                   = lv_cuobj
      IMPORTING
        e_owner                      = ls_root_obj
      EXCEPTIONS
        invalid_instance             = 1
        instance_is_a_classification = 2
        unknown_owner                = 3
        internal_error               = 4
        OTHERS                       = 5.
    IF sy-subrc <> 0.
*** Fehlermeldung
      MESSAGE i000(vz) WITH ‘FEHLER GET_OWNER’ lv_cuobj.
    ELSE.
*** Sichern der geänderten Konfiguration
      CALL FUNCTION ‘CUCB_CONFIGURATION_TO_DB’
        EXPORTING
          root_instance                 = lv_cuobj
          root_object                   = ls_root_obj
        EXCEPTIONS
          invalid_instance              = 1
          invalid_root_instance         = 2
          no_changes                    = 3
          already_registered_for_update = 4
          instance_is_a_classification  = 5
          OTHERS                        = 6.
      IF sy-subrc = 0.
*** Commit
        COMMIT WORK.
*** Erfolgsmeldung
        MESSAGE s000(vz) WITH ‘Konfiguration gesichert’.
      ELSE.
*** Fehlermeldung
        MESSAGE i000(vz)
           WITH ‘FEHLER BEIM SICHERN DER KONFIGURATION’ sy-subrc.
      ENDIF.
    ENDIF.
  ENDIF.

Enno Wulff
Letzte Artikel von Enno Wulff (Alle anzeigen)

Leave a Comment